package com.qq.spirit.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class XmlNodeData implements Serializable
{
	private boolean isLoadSuc=false;
	// 节点名
	private String nodeName = "";
	private String NodeValue = "";
	
	// 父节点
	private XmlNodeData parent = null;
	// 所有子节点
	private List<XmlNodeData> childData = new ArrayList<XmlNodeData>();

	public List<XmlNodeData> getChildNodeData(String name)
	{
		List<XmlNodeData> cNList = new ArrayList<XmlNodeData>();
		for (XmlNodeData x : childData)
		{
			if (x.getNodeName().equals(name))
			{
				cNList.add(x);
			}
		}
		return cNList;
	}

	public boolean isLoadSuc()
	{
		return isLoadSuc;
	}

	public void setLoadSuc(boolean isLoadSuc)
	{
		this.isLoadSuc = isLoadSuc;
	}

	public void setValue(String s, String v)
	{
		XmlNodeData xlist = XmlDataUtil.getNodeInfo(this, s);
		if (xlist != null)
		{
			xlist.setNodeValue(v);
		}
	}

	public XmlNodeData getParent()
	{
		return parent;
	}

	public void setParent(XmlNodeData parent)
	{
		this.parent = parent;
	}

	public void setNodeName(String nodeName)
	{
		this.nodeName = nodeName;
	}

	public String getNodeValue()
	{
		return NodeValue;
	}

	public void setNodeValue(String NodeValue)
	{
		this.NodeValue = NodeValue;
	}

	public String getNodeName()
	{
		return nodeName;
	}

	public void addChild(XmlNodeData x)
	{
		x.parent = this;
		childData.add(x);
	}
}
